Skip to content

refactor: align List tokens, spacing and typography with MD3 - #5041

Open
adam-sajko wants to merge 3 commits into
callstack:mainfrom
adam-sajko:feat/list-md3-tokens-spacing
Open

refactor: align List tokens, spacing and typography with MD3#5041
adam-sajko wants to merge 3 commits into
callstack:mainfrom
adam-sajko:feat/list-md3-tokens-spacing

Conversation

@adam-sajko

@adam-sajko adam-sajko commented Aug 7, 2026

Copy link
Copy Markdown

Motivation

List.Item and List.Accordion now follow the MD3 list spec for padding, type, and colour instead of hardcoded sizes and the old expanded primary tint.

Visual changes

  • One-line rows: 16dp vertical padding (was 14). Height 56dp.
  • Two-line rows: 14dp vertical padding. Height 72dp.
  • Three-line rows: 12dp vertical padding when the description wraps. Height 88dp.
  • Title is bodyLarge, supporting text is bodyMedium (line height 24 / 20).
  • Trailing inset 16dp (was 24). Checkboxes and chevrons sit 8dp closer to the edge.
  • Expanded accordion title and leading icon stay onSurface / onSurfaceVariant (no primary tint).

Related issue

Related to #4976

Test plan

  • Unit tests for the theme override reaching title/description typography
  • Unit tests for 12dp padding when the description wraps
  • Snapshots updated on purpose (padding, type, trailing inset)

@adam-sajko
adam-sajko marked this pull request as ready for review August 18, 2026 08:26

@MikitasK MikitasK left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job 👏 overall, this refactoring looks solid 👍
just a few thing to consider before merge:

Comment on lines 186 to 194
<Text
variant="bodyMedium"
selectable={false}
numberOfLines={descriptionNumberOfLines}
ellipsizeMode={descriptionEllipsizeMode}
style={[
styles.description,
{ color: descriptionColor },
descriptionStyle,
]}
style={[{ color: descriptionColor }, descriptionStyle]}
onTextLayout={onDescriptionTextLayout}
maxFontSizeMultiplier={descriptionMaxFontSizeMultiplier}
>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about passing resolved theme to these Text components?

<Text theme={theme} variant="bodyMedium" ... >

in current implementation component-level font overrides are used for render-prop titles & descriptions, but plain text still reads typography from the surrounding provider

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 211 to 220
<Text
variant="bodyLarge"
selectable={false}
ellipsizeMode={titleEllipsizeMode}
numberOfLines={titleNumberOfLines}
style={[styles.title, { color: titleColor }, titleStyle]}
style={[{ color: titleColor }, titleStyle]}
maxFontSizeMultiplier={titleMaxFontSizeMultiplier}
>
{title}
</Text>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 277 to 306
@@ -285,10 +290,10 @@ const ListAccordion = ({
</Text>
{description ? (
<Text
variant="bodyMedium"
selectable={false}
numberOfLines={descriptionNumberOfLines}
style={[
styles.description,
{
color: descriptionColor,
},
@@ -301,20 +306,15 @@ const ListAccordion = ({
</Text>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread src/components/List/ListItem.tsx Outdated
style={[styles.container, style]}
style={[
styles.container,
description ? styles.containerTwoLine : styles.containerOneLine,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about descriptions with 2+ lines? they currently keep 14dp 2-line padding, resulting in 92dp item instead of MD3 88dp minimum (source)
so can we use 12dp vertical padding (multilineVerticalPadding: 12) whenever lines.length >= 2?

Suggested change
description ? styles.containerTwoLine : styles.containerOneLine,
description
? isDescriptionMultiline
? styles.containerMultiline
: styles.containerTwoLine
: styles.containerOneLine

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, also corrected end inset 24 -> 16 to match current MD3/Compose

Just one caveat: onTextLayout isn’t implemented in react-native-web, so this tier only applies on native. That’s pre-existing (alignToTop already does nothing on web before)

Comment thread src/components/List/ListAccordion.tsx Outdated
style={[styles.container, style]}
style={[
styles.container,
description ? styles.containerTwoLine : styles.containerOneLine,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@MikitasK MikitasK left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants